// WindoStatDlg.cpp : implementation file
//

#include "StdAfx.h"
#include "StdArx.h"
#include "resource.h"
#include "WindoStatDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CWindoStatDlg dialog


CWindoStatDlg::CWindoStatDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CWindoStatDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CWindoStatDlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CWindoStatDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CWindoStatDlg)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CWindoStatDlg, CDialog)
	//{{AFX_MSG_MAP(CWindoStatDlg)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CWindoStatDlg message handlers

BOOL CWindoStatDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	CListCtrl* pList;
	pList = (CListCtrl*) GetDlgItem(IDC_LIST_WINDOSTAT);

	char* arCols[5] = {"Type", "Cols", "Rows", "Height", "Width"};

	LV_COLUMN lvCol;

	lvCol.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT;
	lvCol.fmt = LVCFMT_LEFT;
	lvCol.cx = 50;

	for(int nColumn = 0; nColumn < 5; nColumn++)
	{
		lvCol.pszText = arCols[nColumn];
		pList->InsertColumn(nColumn, &lvCol);
	}

	if(strcmp(windInfo.windType, "Rect") == 0)
	{
		pList->InsertItem(0, "Rect");
	}
	else if(strcmp(windInfo.windType, "Arch") == 0)
	{
		pList->InsertItem(0, "Arch");
	}
	else
	{
		pList->InsertItem(0, "Apex");
	}
	
	char temp[80];
		
	pList->SetItemText(0, 1, itoa(windInfo.m_nCols, temp, 10));
	pList->SetItemText(0, 2, itoa(windInfo.m_nRows, temp, 10));

	acdbRToS(windInfo.m_dWindHt, 2, 3, temp);
	pList->SetItemText(0, 3, temp);

	acdbRToS(windInfo.m_dWindWt, 2, 3, temp);
	pList->SetItemText(0, 4, temp);
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
